	#include <inavr.h>
	#include <iom32a.h>
	#include <stdio.h>
	#include "AVR_ADC_drv.h"
	
	int AVR_ADC(void)
	{
        int data = 0; //result of conversation
	//Ports initialization
	DDR_ADC  |= 0xEF;
	//PORT_ADC |= (1<<ADC_IN4);
	
		//ADC Init
		//EXTERNAL REF, LEFT, 4 CHANEL
		ADMUX 	|= (0<<REFS1)|(0<<REFS1)|(1<<ADLAR)|(0<<MUX4)|(0<<MUX3)|(1<<MUX2)|(0<<MUX1)|(0<<MUX0);
		//ADC ENABLE, SINGLE CONV MODE, INTERRUPT ENABLE, PRESCALER =128
		ADCSRA	|= (1<<ADEN)|(0<<ADSC)|(0<<ADATE)|(0<<ADIF)|(0<<ADIE)|(1<<ADPS2)|(0<<ADPS1)|(1<<ADPS0);
		
		
		StartConvADC();
                
                while(((ADCSRA) & (1<<ADIF))!=0x10)// end of conversation waiting
                {
                }
                
                data = ADCH;
                ADCSRA	|= (1<<ADIF);
                return data;
                  
	}